from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow

# 创建数据库操作对象
db = SQLAlchemy()
ma = Marshmallow()

# 定义一个方法，用于创建app对象
def create_app():
    app = Flask(__name__)
    # 载入数据库配置
    app.config.from_object('conf.dbconfigs')
    # 数据库操作对象绑定app
    db.init_app(app)
    ma.init_app(app)
    
    return app
